package spittr.web;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class AppWideExceptionHandler {

  @ExceptionHandler(DuplicateSpittleException.class)
  //此处还可改变请求状态 @ResponseStatus(value=HttpStatus.NOT_FOUND, reason="Spittle Not Found")
  @ResponseBody
  public Object duplicate() {
    return "error";
  }

}
